import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class PayrollSortBean implements WritableComparable<PayrollSortBean>
{


    private Double salary;


    public PayrollSortBean(Double salary) {
        this.salary = salary;

    }

    public PayrollSortBean() {
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }


    @Override
    public String toString() {
        return "salary=" + salary ;

    }

    public int compareTo(PayrollSortBean o) {
        return -this.salary.compareTo(o.salary);
    }

    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeDouble(salary);

    }

    public void readFields(DataInput dataInput) throws IOException {
        this.salary=dataInput.readDouble();

    }
}
